<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/WEB-INF/inc.jsp" %>
<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <title>成都文理学院政治理论在线测试系统</title>
    <link rel="shortcut icon" href="<%=contextPath%>/images/favicon.ico">
    <link href="<%=contextPath%>/assets/login/css/login.css"
          rel="stylesheet" rev="stylesheet" type="text/css" media="all"/>
    <link href="<%=contextPath%>/assets/login/css/demo.css" rel="stylesheet"
          rev="stylesheet" type="text/css" media="all"/>
    <link href="<%=contextPath%>/css/flexslider.css" rel="stylesheet"
          rev="stylesheet" type="text/css" media="all"/>
    <script type="text/javascript" src="<%=contextPath%>/js/jquery.js"></script>
    <script type="text/javascript"
            src="<%=contextPath%>/assets/login/js/jquery.SuperSlide.js"></script>
    <script type="text/javascript" src="<%=contextPath%>/js/jquery.form.js"></script>
    <script type="text/javascript" src="<%=contextPath%>/js/jquery.flexslider-min.js"></script>
    <script>
        function validate(formData, jqForm, options) { //在这里对表单进行验证，如果不符合规则，将返回false来阻止表单提交，直到符合规则为止
            for (var i = 0; i < formData.length; i++) {
                if (!formData[i].value) {
                    $(".error-box").html('用户名或密码不能为空!');
                    return false;
                }
            }
            return true;
        }

        $(function () {
            $('#loginForm').submit(function () {
                $(this).ajaxSubmit({
                    dataType: 'json',
                    beforeSubmit: validate, //验证
                    success: function (data) {  //此处接收到控制器传来的map数据
                        if (data.success) {
                            location.href = "<%=contextPath%>/index";
                        } else {
                            $(".error-box").html(data.message);
                            refreshCaptcha();
                        }
                    }
                });
                return false; //阻止表单默认提交
            });
        });
    </script>
</head>
<body>
<div align="center">
    <img width="1200" alt="logo"
         src="<%=contextPath%>/images/logo.png"/>

</div>

<div class="banner" style="background-color:#0080c0;">

    <div class="login-aside">
        <div id="o-box-up"></div>
        <div id="o-box-down" style="table-layout: fixed;">
            <div class="error-box"></div>

            <form id="loginForm" class="registerform"
                  action="<%=contextPath%>/login.json" method="post">
                <div class="fm-item">
                    <label for="studentNo" class="form-label">登录名：</label> <input
                        type="text" name="studentNo" id="studentNo" class="i-text"/>

                    <div class="ui-form-explain"></div>
                </div>

                <div class="fm-item">
                    <label for="schoolNo" class="form-label">密码：</label> <input
                        type="password" name="schoolNo" id="schoolNo" class="i-text"/>

                    <div class="ui-form-explain"></div>
                </div>

                <div class="fm-item pos-r">
                    <label for="yzm" class="form-label">验证码</label> <input
                        type="text" name="captcha" id="yzm" class="i-text yzm"/>

                    <div class="ui-form-explain">
                        <img id="captcha" onclick="javascript:refreshCaptcha();"
                             src="<%=contextPath%>/getCaptcha" class="yzm-img"/>
                    </div>
                </div>

                <div class="fm-item">
                    <label for="send-btn" class="form-label"></label> <input
                        type="submit" value="" tabindex="4" id="send-btn"
                        class="btn-login"/>

                    <div class="ui-form-explain"></div>
                </div>
            </form>
        </div>
    </div>
    <div class="flexslider" style="top:40px;width:700px;left:40px;">
        <ul class="slides">
            <li>
                <a href="http://www.cdcas.edu.cn"><img src="<%=contextPath%>/images/1.jpg" alt=""
                                                       style="width:700px;height:300px;"></a>
            </li>
            <li style="display:none">
                <a href="http://www.cdcas.edu.cn/xyzl/xyfg.htm"><img src="<%=contextPath%>/images/2.jpg" alt=""
                                                                     style="width:700px;height:300px;"></a>
            </li>
            <li style="display:none">
                <a href="javascript:;"><img src="<%=contextPath%>/images/3.jpg" alt=""
                                            style="width:700px;height:300px;"></a>
            </li>
            <li style="display:none">
                <a href="http://hc.cdcas.edu.cn/CdcasPicture.aspx"><img src="<%=contextPath%>/images/4.jpg" alt=""
                                                                        style="width:700px;height:300px;"></a>
            </li>
            <li style="display:none">
                <a href="javascript:;"><img src="<%=contextPath%>/images/5.jpg" alt=""
                                            style="width:700px;height:300px;"></a>
            </li>
        </ul>
    </div>
</div>
<div align="center">主办：成都文理学院党委办公室（党校办公室电话：028-61565133)</div>
<div align="center">技术支持：成都文理学院信息技术学院</div>
<div align="center">地址：成都市金堂县金堂学府大道218号</div>
<input type="hidden" value="悄悄咪咪隐藏一个在这，我是2012级电子商务的黄欢，哈哈哈哈！"/>

<script type="text/javascript">
    function refreshCaptcha() {
        $("#captcha").attr("src",
            '<%=contextPath%>/getCaptcha?t=' + Math.random());
    }

    $(window).load(function () {
        $('.flexslider').flexslider({
            animation: "slide"
        });

    });
</script>
</body>
</html>